package com.jmu.edu.IMApplication.utils;

import android.util.Log;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

import cn.jpush.im.android.api.ContactManager;
import cn.jpush.im.android.api.JMessageClient;
import cn.jpush.im.android.api.callback.GetUserInfoListCallback;
import cn.jpush.im.android.api.model.UserInfo;
import cn.jpush.im.android.api.options.RegisterOptionalUserInfo;
import cn.jpush.im.api.BasicCallback;

/**
 * @author damao
 */
public class LoginUtils {

    /**
     *
     * @param userName
     * @param password
     * @param basicCallback 状态码 状态信息
     */
    public static void login(String userName, String password, BasicCallback basicCallback)
    {
        JMessageClient.login(userName, password, basicCallback);
    }

    /**
     * 退出登录
     */
    public static void logout()
    {
        JMessageClient.logout();
    }

    /**
     * 判断登陆状态
     * @return
     */
    public static boolean isLogin()
    {
        if (JMessageClient.getMyInfo() != null)
        {
            return true;
        }
        return false;
    }

    /**
     * 不指定其他字段的注册
     * @param username
     * @param password
     * @param registerCallBack
     */
    public static void register(String username, String password, BasicCallback registerCallBack)
    {
        JMessageClient.register(username, password, registerCallBack);
    }

    /**
     * 指定详细字段的注册
     * @param username
     * @param password
     * @param optionalUserInfo
     * @param registerCallBack
     */
    public static void register(String username, String password, RegisterOptionalUserInfo optionalUserInfo, BasicCallback registerCallBack)
    {
        JMessageClient.register(username, password, optionalUserInfo, registerCallBack);
    }


}
